<?php
class CaptchaWidget extends CCaptcha {
    /**
     * @var string images path of this widget
     */
    public $imagesPath;
    public $template='{captcha}{description}';
    public $description;

    /**
     * Initializes the widgets
     */
    public function init() {
        parent::init();

        if($this->imagesPath===null) $this->imagesPath = $this->controller->imagesPath;
        
        $this->setId('verification');
        $this->clickableImage = true;
        $this->imageOptions = array('alt'=>'verification');
    }//end function


    /**
     * Execute the widgets
     */
    public function run() {
        
        if(empty($this->template)) return;
        
        $layout=strtr($this->template, array_filter(array(
            '{description}'=>$this->description,
        )));
        
        list($open, $close)=explode('{captcha}',$layout);
        echo $open;
        parent::run();
        echo $close;
    }//end function
}//end class